using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using clf.weighing.entity;

namespace weighing
{

    /// <summary>
    /// 物资价格
    /// 数据条数:0
    /// 数据大小:16KB
    /// </summary>


    public class MaterialPriceVo : BaseVo
    {
        #region Constract
        public MaterialPrice mMaterialPrice;
        public MaterialPriceVo(MaterialPrice materialPrice)
        {
            mMaterialPrice = materialPrice;
        }
        #endregion


        /// <summary>
        /// 可空:NO
        /// </summary>

        public Int64 Id { get { return mMaterialPrice.id; } set { mMaterialPrice.id = value; OnPropertyChanged(this, nameof(Id)); } }

        /// <summary>
        /// 注释:物料名称
        /// 可空:YES
        /// </summary>

        public Int64? MaterialId { get { return mMaterialPrice.materialId; } set { mMaterialPrice.materialId = value; OnPropertyChanged(this, nameof(MaterialId)); } }

        /// <summary>
        /// 注释:物料名称
        /// 可空:YES
        /// </summary>

        public String MaterialName { get { return mMaterialPrice.materialName; } set { mMaterialPrice.materialName = value; OnPropertyChanged(this, nameof(MaterialName)); } }

        /// <summary>
        /// 注释:生效时间
        /// 可空:YES
        /// </summary>

        public DateTime? EffectiveTime { get { return mMaterialPrice.effectiveTime; } set { mMaterialPrice.effectiveTime = value; OnPropertyChanged(this, nameof(EffectiveTime)); } }

        /// <summary>
        /// 注释:失效时间
        /// 可空:YES
        /// </summary>

        public DateTime? FailureTime { get { return mMaterialPrice.failureTime; } set { mMaterialPrice.failureTime = value; OnPropertyChanged(this, nameof(FailureTime)); } }

        /// <summary>
        /// 注释:状态(0未生效 1生效中 2失效)
        /// 可空:NO
        ///默认值:0
        /// </summary>

        public Int32? Status { get { return mMaterialPrice.status; } set { mMaterialPrice.status = value; OnPropertyChanged(this, nameof(Status)); } }

        /// <summary>
        /// 注释:价格
        /// 可空:NO
        ///默认值:0.000
        /// </summary>

        public Decimal Price { get { return mMaterialPrice.price; } set { mMaterialPrice.price = value; OnPropertyChanged(this, nameof(Price)); } }

        /// <summary>
        /// 注释:价格类型 0 采购 1 销售
        /// 可空:NO
        ///默认值:0
        /// </summary>

        public Int32? Type { get { return mMaterialPrice.type; } set { mMaterialPrice.type = value; OnPropertyChanged(this, nameof(Type)); } }

        /// <summary>
        /// 注释:属性 1 企业 10政府
        /// 可空:NO
        ///默认值:1
        /// </summary>

        public Int32? Belong { get { return mMaterialPrice.belong; } set { mMaterialPrice.belong = value; OnPropertyChanged(this, nameof(Belong)); } }

        /// <summary>
        /// 可空:YES
        /// </summary>

        public Int64? AddUserId { get { return mMaterialPrice.addUserId; } set { mMaterialPrice.addUserId = value; OnPropertyChanged(this, nameof(AddUserId)); } }

        /// <summary>
        /// 可空:YES
        /// </summary>

        public String AddUserName { get { return mMaterialPrice.addUserName; } set { mMaterialPrice.addUserName = value; OnPropertyChanged(this, nameof(AddUserName)); } }

        /// <summary>
        /// 可空:YES
        /// </summary>

        public DateTime? LastUpdateTime { get { return mMaterialPrice.lastUpdateTime; } set { mMaterialPrice.lastUpdateTime = value; OnPropertyChanged(this, nameof(LastUpdateTime)); } }

        /// <summary>
        /// 可空:YES
        ///默认值:0
        /// </summary>

        public Int32? IsDelete { get { return mMaterialPrice.isDelete; } set { mMaterialPrice.isDelete = value; OnPropertyChanged(this, nameof(IsDelete)); } }

        /// <summary>
        /// 可空:YES
        /// </summary>

        public DateTime? DeleteTime { get { return mMaterialPrice.deleteTime; } set { mMaterialPrice.deleteTime = value; OnPropertyChanged(this, nameof(DeleteTime)); } }

        /// <summary>
        /// 可空:YES
        /// </summary>

        public Int64? LastUpdateUserId { get { return mMaterialPrice.lastUpdateUserId; } set { mMaterialPrice.lastUpdateUserId = value; OnPropertyChanged(this, nameof(LastUpdateUserId)); } }

        /// <summary>
        /// 可空:YES
        /// </summary>

        public String LastUpdateUserName { get { return mMaterialPrice.lastUpdateUserName; } set { mMaterialPrice.lastUpdateUserName = value; OnPropertyChanged(this, nameof(LastUpdateUserName)); } }

        /// <summary>
        /// 注释:所属公司
        /// 可空:YES
        ///默认值:0
        /// </summary>

        public Int64? AffiliatedCompanyId { get { return mMaterialPrice.affiliatedCompanyId; } set { mMaterialPrice.affiliatedCompanyId = value; OnPropertyChanged(this, nameof(AffiliatedCompanyId)); } }

        /// <summary>
        /// 注释:添加时间
        /// 可空:YES
        /// </summary>

        public DateTime? AddTime { get { return mMaterialPrice.addTime; } set { mMaterialPrice.addTime = value; OnPropertyChanged(this, nameof(AddTime)); } }


        #region TEXT

        public string PirceStatusText
        {
            get
            {
                if (EffectiveTime < DateTime.Now && FailureTime > DateTime.Now)
                {
                    return "生效中";
                }
                if (EffectiveTime < DateTime.Now)
                {
                    return "失效";
                }

                if (FailureTime > DateTime.Now)
                {
                    return "未生效";
                }
                return "未知";
            }
        }

        public string TypeText
        {
            get
            {
              if(Type  == (int) MaterialPriceType.Buy) return "进价";

              if (Type == (int)MaterialPriceType.Sale) return "售价";

              return "";
            }
        }

        #endregion
    }
}
